package cn.itcast.hotel.controller;

import cn.itcast.hotel.dto.PageResult;
import cn.itcast.hotel.dto.RequestParam;
import cn.itcast.hotel.pojo.HotelDoc;
import cn.itcast.hotel.service.IHotelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;


@RestController
@RequestMapping("/hotel")
public class HotelController {


    @Autowired
    IHotelService hotelService;

    @PostMapping("/list")
    public PageResult<HotelDoc> searchHotelList(@RequestBody RequestParam param){
        return hotelService.searchHotelList(param);
    }
    @PostMapping("/filters")
    public Map<String, List<String>> filters(@RequestBody RequestParam param){
        return hotelService.getMultiAggregation(param);
    }
    @GetMapping("/suggestion")
    public List<String> getSuggestions(@org.springframework.web.bind.annotation.RequestParam("key") String prefix){
        return hotelService.getSuggestions(prefix);
    };


}
